/**
 * @ClassName Offer11
 * @Description 剑指 Offer 11. 旋转数组的最小数字
 * @Author clockTown
 * @Date 2021/8/16 15:19
 * @Version 1.0
 */
class Offer11 {
}

/**
 * v0 二分查找
 */
class Offer11V0 {
    public int minArray(int[] numbers) {
        int l = 0;
        int r = numbers.length - 1;
        while (l <= r){
            int mid = (l + r) >> 1;
            if (numbers[mid] < numbers[r]){
                r = mid;
            }else if (numbers[mid] > numbers[r]){
                l = mid + 1;
            }else {
                r = r - 1;
            }
        }
        return numbers[l];
    }
}